﻿using System.Reflection;
using Proto;

namespace sgf.server.cluster;

public class Program : BusActor
{
    public static async Task Main(string[] args)
    {
        var configFileName = "config.property";
        if (args.Length > 0)
        {
            configFileName = args[0];
        }

        LogMgr.Init();
        //初始化配置
        Config.Init(configFileName);
        IDGenerator.Init(1);
        HotfixMgr.Load();
        // 获取当前执行程序集
        var assembly = Assembly.GetExecutingAssembly();
        HotfixMgr.LoadAssembly(assembly);
        //初始化AreaCore
        var actorCore = new ActorCoreCluster();
        actorCore.AddActorBus<Program>();
        actorCore.Start();
        Console.ReadLine();
    }

    public override async Task OnStart(IContext context)
    {
        var actorCore = ActorCore.Core();
        actorCore.AddActorBus<NetActor>();
    }
}